import {GameFrameworkEventArgs} from "../Base/GameFrameworkEventArgs";
import {ReferencePool} from "../Base/ReferencePool/ReferencePool";

export class WebRequestSuccessEventArgs extends GameFrameworkEventArgs {
    get m_WebResponseBytes(): number[] {
        return this._webResponseBytes;
    }

    get serialId(): number {
        return this._serialId;
    }

    get webRequestUri(): string {
        return this._webRequestUri;
    }

    get userData() {
        return this._userData;
    }

    private _webResponseBytes: number[];
    private _serialId: number;
    private _webRequestUri: string;
    private _userData;

    public static Create(serialId: number, webRequestUri: string, webResponseBytes: number[], userData): WebRequestSuccessEventArgs {
        let webRequestSuccessEventArgs: WebRequestSuccessEventArgs = ReferencePool.Acquire(WebRequestSuccessEventArgs);
        webRequestSuccessEventArgs._serialId = serialId;
        webRequestSuccessEventArgs._webRequestUri = webRequestUri;
        webRequestSuccessEventArgs._webResponseBytes = webResponseBytes;
        webRequestSuccessEventArgs._userData = userData;
        return webRequestSuccessEventArgs;
    }

    constructor() {
        super();
        this._serialId = 0;
        this._webResponseBytes = null;
        this._webRequestUri = null;
        this._userData = null;
    }


    Clear(): void {
        this._serialId = 0;
        this._webResponseBytes = null;
        this._webRequestUri = null;
        this._userData = null;
    }

}